package com.biz;

import com.dao.NoticeMapper;
import com.entity.Notice;
import com.util.PageBean;
import jdk.nashorn.internal.ir.annotations.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2019/1/19/019.
 */

@Service
public class INoticeBizImp implements INoticeBiz {

    @Autowired
    private NoticeMapper dao;

    @Override
    public List<Notice> getAll() {
        return dao.getAll();
    }

    @Override
    public void add_notice(Notice nn) {
        dao.add_notice(nn);
    }

    @Override
    public void del_notice(int id) {
         dao.del_notice(id);
    }

    @Override
    public Notice getById(int id) {
        return dao.getById(id);
    }

    @Override
    public void mod_notice(Notice nn) {
        dao.mod_notice(nn);
    }

    @Override
    public PageBean getPage_notice(int page, String content) {
        PageBean bean=new PageBean();
        bean.setCurrpage(page);
        bean.setPagesize(5);
        bean.setList(dao.getAll_notice(page,bean.getPagesize(),content));
        bean.setTotalrow(dao.getCount_notice(content));
        return bean;
    }

    @Override
    public List<Notice> getNewFive() {
        return dao.getNewFive();
    }
}
